/*
wellbye：这个文件是自动生成的，不要手工修改！ 
*/
using System;
using System.Collections;
using ILRuntime.CLR.Method;
using ILRuntime.Other;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;

[ILRAdaptor]
public class ILRAdaptor_IListString : CrossBindingAdaptor
{
    public override Type BaseCLRType { get { return typeof(System.Collections.Generic.IList<string>); } }
    public override Type AdaptorType { get { return typeof(Adaptor); } }

    public override object CreateCLRInstance(ILRuntime.Runtime.Enviorment.AppDomain appDomain, ILTypeInstance instance)
    {
        return new Adaptor(appDomain, instance); //创建一个新的实例
    }

    //实际的适配器类需要继承你想继承的那个类，并且实现CrossBindingAdaptorType接口
    public class Adaptor : System.Collections.Generic.IList<string>, CrossBindingAdaptorType
    {
        ILTypeInstance instance;
        ILRuntime.Runtime.Enviorment.AppDomain appDomain;

        public Adaptor() { }

        public Adaptor(ILRuntime.Runtime.Enviorment.AppDomain appDomain, ILTypeInstance instance)
        {
            this.appDomain = appDomain;
            this.instance = instance;
        }

        public ILTypeInstance ILInstance { get { return instance; } }

        bool isCallingget_Count = false;
        IMethod methodget_Count;
        public int Count
        {
            get
            {
                if (methodget_Count == null && instance != null)
                {
                    methodget_Count = instance.Type.GetMethod("get_Count", 0);
                }
                if (methodget_Count != null && !isCallingget_Count)
                {
                    isCallingget_Count = true;

                    try
                    {

                        object ret = appDomain.Invoke(methodget_Count, instance, null);

                        isCallingget_Count = false;

                        return (int) ret;

                    }
                    catch (Exception e)
                    {
                        mb.App.logger.Log("**** Catch Exception In get_Count *****");
                        mb.App.logger.Log(e.ToString());
                        mb.App.logger.Log("**********************");
                        throw e;
                    }
                }
                else
                {
                    return 0;
                }
            }
        }

        bool isCallingget_IsReadOnly = false;
        IMethod methodget_IsReadOnly;
        public bool IsReadOnly
        {
            get
            {
                if (methodget_IsReadOnly == null && instance != null)
                {
                    methodget_IsReadOnly = instance.Type.GetMethod("get_IsReadOnly", 0);
                }
                if (methodget_IsReadOnly != null && !isCallingget_IsReadOnly)
                {
                    isCallingget_IsReadOnly = true;

                    try
                    {

                        object ret = appDomain.Invoke(methodget_IsReadOnly, instance, null);

                        isCallingget_IsReadOnly = false;

                        return (bool) ret;

                    }
                    catch (Exception e)
                    {
                        mb.App.logger.Log("**** Catch Exception In get_IsReadOnly *****");
                        mb.App.logger.Log(e.ToString());
                        mb.App.logger.Log("**********************");
                        throw e;
                    }
                }
                else
                {
                    return false;
                }
            }
        }

        IMethod methodget_Item0;
        bool isCallingget_Item0 = false;

        public string this [int index]
        {
            get
            {
                return getItem(index);
            }
            set
            {
                setItem(index, value);
            }
        }
        System.String getItem(System.Int32 p0)
        {
            if (methodget_Item0 == null && instance != null)
            {
                methodget_Item0 = instance.Type.GetMethod("get_Item", 1);
            }
            if (methodget_Item0 != null && !isCallingget_Item0)
            {
                isCallingget_Item0 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                    };
                    object ret = appDomain.Invoke(methodget_Item0, instance, param);

                    isCallingget_Item0 = false;

                    return (System.String) ret;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In get_Item *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

                return default(System.String);

            }
        }

        IMethod methodset_Item1;
        bool isCallingset_Item1 = false;

        public void setItem(System.Int32 p0, System.String p1)
        {
            if (methodset_Item1 == null && instance != null)
            {
                methodset_Item1 = instance.Type.GetMethod("set_Item", 2);
            }
            if (methodset_Item1 != null && !isCallingset_Item1)
            {
                isCallingset_Item1 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                        p1,
                    };
                    object ret = appDomain.Invoke(methodset_Item1, instance, param);

                    isCallingset_Item1 = false;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In set_Item *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

            }
        }

        IMethod methodIndexOf2;
        bool isCallingIndexOf2 = false;

        public System.Int32 IndexOf(System.String p0)
        {
            if (methodIndexOf2 == null && instance != null)
            {
                methodIndexOf2 = instance.Type.GetMethod("IndexOf", 1);
            }
            if (methodIndexOf2 != null && !isCallingIndexOf2)
            {
                isCallingIndexOf2 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                    };
                    object ret = appDomain.Invoke(methodIndexOf2, instance, param);

                    isCallingIndexOf2 = false;

                    return (System.Int32) ret;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In IndexOf *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

                return default(System.Int32);

            }
        }

        IMethod methodInsert3;
        bool isCallingInsert3 = false;

        public void Insert(System.Int32 p0, System.String p1)
        {
            if (methodInsert3 == null && instance != null)
            {
                methodInsert3 = instance.Type.GetMethod("Insert", 2);
            }
            if (methodInsert3 != null && !isCallingInsert3)
            {
                isCallingInsert3 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                        p1,
                    };
                    object ret = appDomain.Invoke(methodInsert3, instance, param);

                    isCallingInsert3 = false;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In Insert *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

            }
        }

        IMethod methodRemoveAt4;
        bool isCallingRemoveAt4 = false;

        public void RemoveAt(System.Int32 p0)
        {
            if (methodRemoveAt4 == null && instance != null)
            {
                methodRemoveAt4 = instance.Type.GetMethod("RemoveAt", 1);
            }
            if (methodRemoveAt4 != null && !isCallingRemoveAt4)
            {
                isCallingRemoveAt4 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                    };
                    object ret = appDomain.Invoke(methodRemoveAt4, instance, param);

                    isCallingRemoveAt4 = false;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In RemoveAt *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

            }
        }

        IMethod methodGetEnumerator5;
        bool isCallingGetEnumerator5 = false;

        public System.Collections.Generic.IEnumerator<string> GetEnumerator()
        {
            if (methodGetEnumerator5 == null && instance != null)
            {
                methodGetEnumerator5 = instance.Type.GetMethod("GetEnumerator", 0);
            }
            if (methodGetEnumerator5 != null && !isCallingGetEnumerator5)
            {
                isCallingGetEnumerator5 = true;

                try
                {

                    //无参数调用
                    object ret = appDomain.Invoke(methodGetEnumerator5, instance, null);

                    isCallingGetEnumerator5 = false;

                    return (System.Collections.Generic.IEnumerator<string>) ret;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In GetEnumerator *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

                return default(System.Collections.Generic.IEnumerator<string>);

            }
        }

        IMethod methodGetEnumerator6;
        bool isCallingGetEnumerator6 = false;

        System.Collections.IEnumerator IEnumerable.GetEnumerator()
        {
            if (methodGetEnumerator6 == null && instance != null)
            {
                methodGetEnumerator6 = instance.Type.GetMethod("GetEnumerator", 0);
            }
            if (methodGetEnumerator6 != null && !isCallingGetEnumerator6)
            {
                isCallingGetEnumerator6 = true;

                try
                {

                    //无参数调用
                    object ret = appDomain.Invoke(methodGetEnumerator6, instance, null);

                    isCallingGetEnumerator6 = false;

                    return (System.Collections.IEnumerator) ret;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In GetEnumerator *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

                return default(System.Collections.IEnumerator);

            }
        }

        IMethod methodAdd7;
        bool isCallingAdd7 = false;

        public void Add(System.String p0)
        {
            if (methodAdd7 == null && instance != null)
            {
                methodAdd7 = instance.Type.GetMethod("Add", 1);
            }
            if (methodAdd7 != null && !isCallingAdd7)
            {
                isCallingAdd7 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                    };
                    object ret = appDomain.Invoke(methodAdd7, instance, param);

                    isCallingAdd7 = false;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In Add *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

            }
        }

        IMethod methodClear8;
        bool isCallingClear8 = false;

        public void Clear()
        {
            if (methodClear8 == null && instance != null)
            {
                methodClear8 = instance.Type.GetMethod("Clear", 0);
            }
            if (methodClear8 != null && !isCallingClear8)
            {
                isCallingClear8 = true;

                try
                {

                    //无参数调用
                    object ret = appDomain.Invoke(methodClear8, instance, null);

                    isCallingClear8 = false;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In Clear *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

            }
        }

        IMethod methodContains9;
        bool isCallingContains9 = false;

        public System.Boolean Contains(System.String p0)
        {
            if (methodContains9 == null && instance != null)
            {
                methodContains9 = instance.Type.GetMethod("Contains", 1);
            }
            if (methodContains9 != null && !isCallingContains9)
            {
                isCallingContains9 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                    };
                    object ret = appDomain.Invoke(methodContains9, instance, param);

                    isCallingContains9 = false;

                    return (System.Boolean) ret;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In Contains *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

                return default(System.Boolean);

            }
        }

        IMethod methodCopyTo10;
        bool isCallingCopyTo10 = false;

        public void CopyTo(System.String[] p0, System.Int32 p1)
        {
            if (methodCopyTo10 == null && instance != null)
            {
                methodCopyTo10 = instance.Type.GetMethod("CopyTo", 2);
            }
            if (methodCopyTo10 != null && !isCallingCopyTo10)
            {
                isCallingCopyTo10 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                        p1,
                    };
                    object ret = appDomain.Invoke(methodCopyTo10, instance, param);

                    isCallingCopyTo10 = false;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In CopyTo *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

            }
        }

        IMethod methodRemove11;
        bool isCallingRemove11 = false;

        public System.Boolean Remove(System.String p0)
        {
            if (methodRemove11 == null && instance != null)
            {
                methodRemove11 = instance.Type.GetMethod("Remove", 1);
            }
            if (methodRemove11 != null && !isCallingRemove11)
            {
                isCallingRemove11 = true;

                try
                {

                    //有参数，打包成数组
                    object[] param = new object[]
                    {
                        p0,
                    };
                    object ret = appDomain.Invoke(methodRemove11, instance, param);

                    isCallingRemove11 = false;

                    return (System.Boolean) ret;

                }
                catch (Exception e)
                {
                    mb.App.logger.Log("**** Catch Exception In Remove *****");
                    mb.App.logger.Log(e.ToString());
                    mb.App.logger.Log("**********************");
                    throw e;
                }
            }
            else
            {

                return default(System.Boolean);

            }
        }

    }
}